﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using SapB1WebApp.DAL;
using SapB1WebApp.Utils;

namespace SapB1WebApp.BLL
{
    public class BusinessPartnersBLL
    {
        public DataSet GetOCRD(string companyDB, string cardType)
        {
            try
            {
                DataSet dt = new DataSet("OCRD");
                BusinessPartnersDAO connect = new BusinessPartnersDAO();
                dt = connect.GetOCRD(companyDB, cardType);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        public DataSet GetOCRD(string companyDB, string keySearch, string cardType)
        {
            try
            {
                DataSet dt = new DataSet("OCRD");
                BusinessPartnersDAO connect = new BusinessPartnersDAO();
                dt = connect.GetOCRD(companyDB,keySearch, cardType);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        public DataSet GetOCRDByCardCode(string companyDB, string cardCode, string cardType)
        {
            try
            {
                DataSet dt = new DataSet("OCRD");
                BusinessPartnersDAO connect = new BusinessPartnersDAO();
                dt = connect.GetOCRDByCardCode(companyDB, cardCode,cardType);
                return dt;
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return null;
            }
        }
        public long CountOCRD(string companyDB,string cardType)
        {
            try
            {
                BusinessPartnersDAO connect = new BusinessPartnersDAO();
                return connect.CountOCRD(companyDB, cardType);
            }
            catch (Exception ex)
            {
                Log.WriteException(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "SystemError", ex);
                return 0;
            }
        }
    }
}